﻿namespace ExamV5.GradeInfo
{
    using ExamV5;
    using System;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.IO;
    using System.Text;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using Wuqi.Webdiyer;

    public class FrmArchiveGradeList : Page
    {
        protected Button butExp;
        protected Button butQuery;
        protected CheckBox CBShowType;
        protected GridView DataGridInfo;
        protected DropDownList DDLArchiveFolder;
        protected DropDownList DDLMoveFolder;
        protected DropDownList DDLQuery;
        protected HtmlForm Form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private HttpCookie httpCookie_1 = null;
        private HttpCookie httpCookie_2 = null;
        private HttpCookie httpCookie_3 = null;
        protected Label labRescordCount;
        protected Label labTip;
        protected LinkButton LBDel;
        protected LinkButton LBDelAll;
        protected LinkButton LBFirstPage;
        protected LinkButton LBLastPage;
        protected LinkButton LBMove;
        protected LinkButton LBNextPage;
        protected LinkButton LBPrevPage;
        protected LinkButton LBSelect;
        private PublicFun publicFun_0 = new PublicFun();
        protected ScriptManager SM;
        protected TextBox txtEndDate;
        protected TextBox txtQuery;
        protected TextBox txtStartDate;
        protected UpdatePanel UPPart;

        protected AspNetPager aspPager;
        protected void butExp_Click(object sender, EventArgs e)
        {
            try
            {
                string cmdText = "";
                string key = Guid.NewGuid().ToString("N").ToUpper();
                string path = base.Server.MapPath("../") + @"\PublicFile\GradeArchiveDataInfo" + key + ".csv";
                string str3 = "";
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
                StreamWriter writer = new StreamWriter(path, true, Encoding.GetEncoding("GB2312"));
                writer.WriteLine("准考证号,考生姓名,考试名称,考试科目,考试原得分,考试现得分,考试时间,考试用时,当前标识");
                cmdText = "select a.LastDate,a.JoinDate,a.SubjectName,a.ID,a.ExamTime,(a.ExamTime-a.LastTime) as ExamUseTime,a.StartTime,a.EndTime,a.UserName,a.UserCode,a.ExamName,a.SubjectName,ROUND(a.GetOldCountFen,2) as GetOldCountFen,ROUND(a.GetCountFen,2) as GetCountFen,Flag=case a.Flag when 'C' then '考试完成' when 'D' then '客观题批改完成' when 'E' then '考试批改完成' when 'G' then '考试异常'  when 'Z' then '作弊标记' end  from GradeArchiveFile a,GradeFolder b where b.ID=a.FolderID ";
                if (this.txtQuery.Text.Trim() != "")
                {
                    cmdText = cmdText + " and " + this.publicFun_0.CheckString(this.DDLQuery.SelectedItem.Value) + " like '%" + this.publicFun_0.CheckString(this.txtQuery.Text) + "%'";
                }
                if (this.txtStartDate.Text.Trim() != "")
                {
                    cmdText = cmdText + " and Convert(dateTime,a.JoinDate)>=Convert(dateTime,'" + this.publicFun_0.CheckString(this.txtStartDate.Text.Trim()) + " 00:00:00')";
                }
                if (this.txtEndDate.Text.Trim() != "")
                {
                    cmdText = cmdText + " and Convert(dateTime,'" + this.publicFun_0.CheckString(this.txtEndDate.Text.Trim()) + " 23:59:59')>=Convert(dateTime,a.JoinDate)";
                }
                if ((this.DDLArchiveFolder.SelectedIndex >= 0) && (this.DDLArchiveFolder.SelectedItem.Value != "0"))
                {
                    cmdText = cmdText + " and a.FolderID='" + this.DDLArchiveFolder.SelectedItem.Value + "'";
                }
                if (!this.CBShowType.Checked)
                {
                    cmdText = cmdText + "  and (b.BrowUserCode like '%,所有人员,%' or b.BrowUserCode like '%," + this.httpCookie_0.Value + ",%' or b.EditUserCode like '%," + this.httpCookie_0.Value + ",%'  or b.BrowDeptID like '%," + this.httpCookie_3.Value + ",%' or b.BrowDeptName like '%,所有部门,%' )";
                }
                else
                {
                    cmdText = cmdText + "  and (b.BrowUserCode like '%,所有人员,%' or b.BrowUserCode like '%," + this.httpCookie_0.Value + ",%' or b.EditUserCode like '%," + this.httpCookie_0.Value + ",%'  or b.BrowDeptID like '%," + this.httpCookie_3.Value + ",%' or b.BrowDeptName like '%,所有部门,%' ) and a.ID in(select Max(ID) from GradeArchiveFile group by UserCode)";
                }
                cmdText = cmdText + "  order by " + this.ViewState["SortFiled"].ToString() + this.ViewState["SortType"].ToString();
                SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
                connection.Open();
                SqlCommand command = new SqlCommand(cmdText, connection);
                SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                while (reader.Read())
                {
                    str3 = "";
                    str3 = (((((str3 + reader["UserCode"].ToString().Trim() + "\x00b7,") + reader["UserName"].ToString().Trim() + ",") + reader["ExamName"].ToString().Trim() + ",") + reader["SubjectName"].ToString().Trim() + ",") + reader["GetOldCountFen"].ToString().Trim() + ",") + reader["GetCountFen"].ToString().Trim() + ",";
                    str3 = str3 + reader["JoinDate"].ToString().Trim() + " " + reader["StartTime"].ToString().Trim() + "---" + reader["LastDate"].ToString().Trim() + " " + reader["EndTime"].ToString().Trim() + ",";
                    int num = Convert.ToInt32(reader["ExamUseTime"].ToString().Trim());
                    if (!((num >= 0) ? (num <= Convert.ToInt32(reader["ExamTime"].ToString().Trim())) : false))
                    {
                        str3 = str3 + reader["ExamTime"].ToString() + "分钟,";
                    }
                    else
                    {
                        str3 = str3 + reader["ExamUseTime"].ToString() + "分钟,";
                    }
                    str3 = str3 + reader["Flag"].ToString().Trim() + ",";
                    writer.WriteLine(str3);
                }
                reader.Close();
                command.Dispose();
                connection.Close();
                connection.Dispose();
                writer.Flush();
                writer.Close();
                this.labTip.Text = " 导出成功！单击【<a href='../FrmDownLoad.aspx?FileName=GradeArchiveDataInfo" + key + ".csv' target=_blank><font color=red>下载</font></a>】进行保存";
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BExpErrTip", @"alert('导出数据失败！\n\n请将PublicFile目录设置为Everyone用户可修改权限！')", true);
            }
            finally
            {
                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "Render", "LayaUIFormRender();", true);
            }
        }

        protected void butQuery_Click(object sender, EventArgs e)
        {
            this.DataGridInfo.PageIndex = 0;
            this.aspPager.CurrentPageIndex = 1;
            this.method_0();
            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "Render", "LayaUIFormRender();", true);
        }

        protected void DataGridInfo_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            this.DataGridInfo.PageIndex = e.NewPageIndex;
            this.method_0();
        }

        protected void DataGridInfo_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //if (e.Row.DataItemIndex != -1)
            //{
            //    e.Row.Attributes.Add("onmouseover", "this.bgColor='#F6F5F5'");
            //    if ((e.Row.DataItemIndex % 2) != 0)
            //    {
            //        e.Row.Attributes.Add("bgcolor", "#FFFFFF");
            //        e.Row.Attributes.Add("onmouseout", "this.bgColor=document.getElementById('DataGridInfo').getAttribute('oldValue')");
            //    }
            //    else
            //    {
            //        e.Row.Attributes.Add("bgcolor", "#FFFFFF");
            //        e.Row.Attributes.Add("onmouseout", "this.bgColor=document.getElementById('DataGridInfo').getAttribute('singleValue')");
            //    }
            //}
            //else
            //{
            //    this.DataGridInfo.Attributes.Add("oldValue", "#FFFFFF");
            //    this.DataGridInfo.Attributes.Add("singleValue", "#FFFFFF");
            //}
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if (e.Row.Cells[3].Text.Length > Convert.ToInt32(this.ViewState["SubStrLen"].ToString()))
                {
                    e.Row.Cells[3].Text = "<a title=" + e.Row.Cells[3].Text + ">" + e.Row.Cells[3].Text.Substring(0, Convert.ToInt32(this.ViewState["SubStrLen"].ToString())) + "…</a>";
                }
                CheckBox box = (CheckBox) e.Row.Cells[0].FindControl("CheckBoxSelect");
                if (this.DataGridInfo.DataKeys[e.Row.RowIndex]["EditUserCode"].ToString().IndexOf("," + this.httpCookie_0.Value + ",") == -1)
                {
                    box.Enabled = false;
                }
                Label label = (Label) e.Row.Cells[8].FindControl("labLook");
                Label label2 = (Label) e.Row.Cells[8].FindControl("labAn");
                label.Text = "<a href='FrmLookArchivePaper.aspx?UserName=" + base.Server.UrlEncode(e.Row.Cells[2].Text) + "&UserCode=" + base.Server.UrlEncode(e.Row.Cells[1].Text) + "&ID=" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["ID"].ToString() + "' title='查看考卷详细批改信息' target='_blank'>" + label.Text + "</a>";
                label2.Text = "<a href='FrmArchiveGradeAN.aspx?UserName=" + base.Server.UrlEncode(e.Row.Cells[2].Text) + "&UserCode=" + base.Server.UrlEncode(e.Row.Cells[1].Text) + "&ID=" + this.DataGridInfo.DataKeys[e.Row.RowIndex]["ID"].ToString() + "' title='查看考生所有历史档案试卷列表' target='_blank'>" + label2.Text + "</a>";
                try
                {
                    int num2 = Convert.ToInt32(e.Row.Cells[4].Text.Replace("&nbsp;", ""));
                    if (!((num2 >= 0) ? (num2 <= Convert.ToInt32(this.DataGridInfo.DataKeys[e.Row.RowIndex]["ExamTime"].ToString())) : false))
                    {
                        e.Row.Cells[4].Text = this.DataGridInfo.DataKeys[e.Row.RowIndex]["ExamTime"].ToString() + "分钟";
                    }
                    else
                    {
                        e.Row.Cells[4].Text = e.Row.Cells[4].Text + "分钟";
                    }
                }
                catch
                {
                    e.Row.Cells[4].Text = this.DataGridInfo.DataKeys[e.Row.RowIndex]["ExamTime"].ToString() + "分钟";
                }
            }
            if (e.Row.RowType == DataControlRowType.Header)
            {
                if (this.ViewState["SortType"].ToString() == " Desc")
                {
                    switch (this.ViewState["SortFiled"].ToString())
                    {
                        case "UserCode":
                            e.Row.Cells[1].Controls.Add(new LiteralControl("↑"));
                            return;

                        case "UserName":
                            e.Row.Cells[2].Controls.Add(new LiteralControl("↑"));
                            return;

                        case "ExamName":
                            e.Row.Cells[3].Controls.Add(new LiteralControl("↑"));
                            return;

                        case "ExamUseTime":
                            e.Row.Cells[4].Controls.Add(new LiteralControl("↑"));
                            return;

                        case "GetOldCountFen":
                            e.Row.Cells[5].Controls.Add(new LiteralControl("↑"));
                            return;

                        case "GetCountFen":
                            e.Row.Cells[6].Controls.Add(new LiteralControl("↑"));
                            return;

                        case "Flag":
                            e.Row.Cells[7].Controls.Add(new LiteralControl("↑"));
                            return;
                    }
                    e.Row.Cells[6].Controls.Add(new LiteralControl("↑"));
                }
                else
                {
                    switch (this.ViewState["SortFiled"].ToString())
                    {
                        case "UserCode":
                            e.Row.Cells[1].Controls.Add(new LiteralControl("↓"));
                            return;

                        case "UserName":
                            e.Row.Cells[2].Controls.Add(new LiteralControl("↓"));
                            return;

                        case "ExamName":
                            e.Row.Cells[3].Controls.Add(new LiteralControl("↓"));
                            return;

                        case "ExamUseTime":
                            e.Row.Cells[4].Controls.Add(new LiteralControl("↓"));
                            return;

                        case "GetOldCountFen":
                            e.Row.Cells[5].Controls.Add(new LiteralControl("↓"));
                            return;

                        case "GetCountFen":
                            e.Row.Cells[6].Controls.Add(new LiteralControl("↓"));
                            return;

                        case "Flag":
                            e.Row.Cells[7].Controls.Add(new LiteralControl("↓"));
                            return;
                    }
                    e.Row.Cells[6].Controls.Add(new LiteralControl("↓"));
                }
            }
        }

        protected void DataGridInfo_Sorting(object sender, GridViewSortEventArgs e)
        {
            string sortExpression = e.SortExpression;
            if (!(this.ViewState["SortFiled"].ToString() == sortExpression))
            {
                this.ViewState["SortFiled"] = e.SortExpression;
            }
            else if (this.ViewState["SortType"].ToString() == " Desc")
            {
                this.ViewState["SortType"] = " ASC";
            }
            else
            {
                this.ViewState["SortType"] = " Desc";
            }
            this.method_0();
            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "Render", "LayaUIFormRender();", true);
        }

        protected void DataGridInfo_PreRender(object sender, EventArgs e)
        {
            // 使用<TH>替换<TD> 
            this.DataGridInfo.UseAccessibleHeader = true;
            //HeaderRow将被<thead>包裹，数据行将被<tbody>包裹
            this.DataGridInfo.HeaderRow.TableSection = TableRowSection.TableHeader;
        }

        protected void aspPager_PageChanged(object sender, EventArgs e)
        {
            this.DataGridInfo.PageIndex = this.aspPager.CurrentPageIndex - 1;
            this.method_0();
            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "Render", "LayaUIFormRender();", true);
        }

        protected void DDLArchiveFolder_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.DataGridInfo.PageIndex = 0;
            this.method_0();
        }

        protected void LBDel_Click(object sender, EventArgs e)
        {
            string str = "";
            for (int i = 0; i < this.DataGridInfo.Rows.Count; i++)
            {
                CheckBox box = (CheckBox) this.DataGridInfo.Rows[i].FindControl("CheckBoxSelect");
                if (box.Checked)
                {
                    str = str + "delete from  GradeArchiveFile where ID=" + this.DataGridInfo.DataKeys[i]["ID"].ToString() + ";";
                }
            }
            if (str != "")
            {
                this.publicFun_0.ExecuteSql(str + "insert into SysLogInfo(LogDisp,EditUser,EditUserCode) values('删除档案柜成绩记录！','" + this.httpCookie_1.Value + "','" + this.httpCookie_0.Value + "')");
            }
            this.DataGridInfo.PageIndex = 0;
            this.method_0();
            this.LBSelect.Text = "选中当页";
            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BDelA", "alert('删除成绩档案操作成功！')", true);
            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "Render", "LayaUIFormRender();", true);
        }

        protected void LBDelAll_Click(object sender, EventArgs e)
        {
            this.publicFun_0.ExecuteSql("delete from  GradeArchiveFile;insert into SysLogInfo(LogDisp,EditUser,EditUserCode) values('清除档案柜所有成绩记录！','" + this.httpCookie_1.Value + "','" + this.httpCookie_0.Value + "')");
            this.DataGridInfo.PageIndex = 0;
            this.method_0();
            this.LBSelect.Text = "选中当页";
            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BDelB", "alert('清除所有成绩档案操作成功！')", true);
            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "Render", "LayaUIFormRender();", true);
        }

        protected void LBFirstPage_Click(object sender, EventArgs e)
        {
            this.DataGridInfo.PageIndex = 0;
            this.method_0();
        }

        protected void LBLastPage_Click(object sender, EventArgs e)
        {
            if (this.DataGridInfo.PageCount > 0)
            {
                this.DataGridInfo.PageIndex = this.DataGridInfo.PageCount - 1;
                this.method_0();
            }
        }

        protected void LBMove_Click(object sender, EventArgs e)
        {
            if (this.DDLMoveFolder.SelectedItem.Value == "0")
            {
                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BCheckFolder", "alert('请选择成绩档案柜！')", true);
            }
            else
            {
                string str = "";
                for (int i = 0; i < this.DataGridInfo.Rows.Count; i++)
                {
                    CheckBox box = (CheckBox) this.DataGridInfo.Rows[i].FindControl("CheckBoxSelect");
                    if (box.Checked)
                    {
                        str = "update GradeArchiveFile set FolderID=" + this.DDLMoveFolder.SelectedItem.Value + " where ID=" + this.DataGridInfo.DataKeys[i]["ID"].ToString() + ";";
                    }
                }
                this.DataGridInfo.PageIndex = 0;
                this.method_0();
                if (str.Trim() != "")
                {
                    this.publicFun_0.ExecuteSql(str + "insert into SysLogInfo(LogDisp,EditUser,EditUserCode) values('将档案考试成绩进行移植操作！','" + this.httpCookie_1.Value + "','" + this.httpCookie_0.Value + "')");
                }
                ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BMoveFolder", "alert('成绩归档移植操作成功！')", true);
            }
            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "Render", "LayaUIFormRender();", true);
        }

        protected void LBNextPage_Click(object sender, EventArgs e)
        {
            if (this.DataGridInfo.PageIndex < (this.DataGridInfo.PageCount - 1))
            {
                this.DataGridInfo.PageIndex++;
                this.method_0();
            }
        }

        protected void LBPrevPage_Click(object sender, EventArgs e)
        {
            if (this.DataGridInfo.PageIndex > 0)
            {
                this.DataGridInfo.PageIndex--;
                this.method_0();
            }
        }

        protected void LBSelect_Click(object sender, EventArgs e)
        {
            int num;
            CheckBox box;
            if (this.LBSelect.Text == "选中当页")
            {
                for (num = 0; num < this.DataGridInfo.Rows.Count; num++)
                {
                    box = (CheckBox) this.DataGridInfo.Rows[num].FindControl("CheckBoxSelect");
                    if (box.Enabled)
                    {
                        box.Checked = true;
                    }
                }
                this.LBSelect.Text = "取消所选";
            }
            else
            {
                for (num = 0; num < this.DataGridInfo.Rows.Count; num++)
                {
                    box = (CheckBox) this.DataGridInfo.Rows[num].FindControl("CheckBoxSelect");
                    box.Checked = false;
                }
                this.LBSelect.Text = "选中当页";
            }
            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "Render", "LayaUIFormRender();", true);
        }

        private void method_0()
        {
            string selectCommandText = "";
            selectCommandText = "select b.EditUserCode,a.ID,a.ExamTime,(a.ExamTime-a.LastTime) as ExamUseTime,a.StartTime,a.EndTime,a.UserName,a.UserCode,a.ExamName,a.SubjectName,ROUND(a.GetOldCountFen,2) as GetOldCountFen,ROUND(a.GetCountFen,2) as GetCountFen,Flag=case a.Flag when 'C' then '考试完成' when 'D' then '客观题批改完成' when 'E' then '考试批改完成' when 'G' then '考试异常'  when 'Z' then '作弊标记' end  from GradeArchiveFile a,GradeFolder b where b.ID=a.FolderID ";
            if (this.txtQuery.Text.Trim() != "")
            {
                selectCommandText = selectCommandText + " and " + this.publicFun_0.CheckString(this.DDLQuery.SelectedItem.Value) + " like '%" + this.publicFun_0.CheckString(this.txtQuery.Text) + "%'";
            }
            if (this.txtStartDate.Text.Trim() != "")
            {
                selectCommandText = selectCommandText + " and Convert(dateTime,a.JoinDate)>=Convert(dateTime,'" + this.publicFun_0.CheckString(this.txtStartDate.Text.Trim()) + " 00:00:00')";
            }
            if (this.txtEndDate.Text.Trim() != "")
            {
                selectCommandText = selectCommandText + " and Convert(dateTime,'" + this.publicFun_0.CheckString(this.txtEndDate.Text.Trim()) + " 23:59:59')>=Convert(dateTime,a.JoinDate)";
            }
            if ((this.DDLArchiveFolder.SelectedIndex >= 0) && (this.DDLArchiveFolder.SelectedItem.Value != "0"))
            {
                selectCommandText = selectCommandText + " and a.FolderID='" + this.DDLArchiveFolder.SelectedItem.Value + "'";
            }
            if (this.CBShowType.Checked)
            {
                selectCommandText = selectCommandText + "  and (b.BrowUserCode like '%,所有人员,%' or b.BrowUserCode like '%," + this.httpCookie_0.Value + ",%' or b.EditUserCode like '%," + this.httpCookie_0.Value + ",%'  or b.BrowDeptID like '%," + this.httpCookie_3.Value + ",%' or b.BrowDeptName like '%,所有部门,%' ) and a.ID in(select Max(ID) from GradeArchiveFile group by UserCode)";
            }
            else
            {
                selectCommandText = selectCommandText + "  and (b.BrowUserCode like '%,所有人员,%' or b.BrowUserCode like '%," + this.httpCookie_0.Value + ",%' or b.EditUserCode like '%," + this.httpCookie_0.Value + ",%' or b.BrowDeptID like '%," + this.httpCookie_3.Value + ",%' or b.BrowDeptName like '%,所有部门,%' )";
            }
            selectCommandText = selectCommandText + "  order by " + this.ViewState["SortFiled"].ToString() + this.ViewState["SortType"].ToString();
            SqlConnection selectConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
            SqlDataAdapter adapter = new SqlDataAdapter(selectCommandText, selectConnection);
            DataSet dataSet = new DataSet();
            adapter.Fill(dataSet, "DataInfo");
            this.DataGridInfo.DataSource = dataSet.Tables["DataInfo"].DefaultView;
            this.DataGridInfo.DataBind();
            //this.labRescordCount.Text = "总共&nbsp;<font color='#0000C0'><b>" + dataSet.Tables["DataInfo"].Rows.Count.ToString() + "</b></font>&nbsp;条记录&nbsp;<font color='#0000C0'><b>" + Convert.ToString((int) (this.DataGridInfo.PageIndex + 1)) + "/" + this.DataGridInfo.PageCount.ToString() + "</b></font>&nbsp;页&nbsp;";
            this.labRescordCount.Text = "总共&nbsp;<i>" + dataSet.Tables["DataInfo"].Rows.Count.ToString() + "</i>&nbsp;条记录&nbsp;<b>" + Convert.ToString((int)(this.DataGridInfo.PageIndex + 1)) + "/" + this.DataGridInfo.PageCount.ToString() + "</b>&nbsp;页&nbsp;";
            this.aspPager.RecordCount = dataSet.Tables["DataInfo"].Rows.Count;
            adapter.Dispose();
            selectConnection.Close();
            selectConnection.Dispose();
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamUserCode");
            this.httpCookie_0 = base.Request.Cookies["ExamUserCode"];
            this.httpCookie_1 = new HttpCookie("ExamUserName");
            this.httpCookie_1 = base.Request.Cookies["ExamUserName"];
            this.httpCookie_2 = new HttpCookie("ExamUserLevel");
            this.httpCookie_2 = base.Request.Cookies["ExamUserLevel"];
            this.httpCookie_3 = new HttpCookie("ExamDeptID");
            this.httpCookie_3 = base.Request.Cookies["ExamDeptID"];
            if (!((this.httpCookie_0 != null) ? !(this.httpCookie_0.Value == "") : false))
            {
                base.Response.Write("<script language=javascript>top.location.href='../Index.htm';self.close();</script>");
            }
            else
            {
                base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                base.Response.Cache.SetNoStore();
                this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
                this.httpCookie_1.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_1.Value));
                this.httpCookie_2.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_2.Value));
                this.httpCookie_3.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_3.Value));
                if (!base.IsPostBack)
                {
                    if (this.publicFun_0.ReturnPaperData() == "Yes")
                    {
                        if (this.httpCookie_2.Value != "A")
                        {
                            this.txtQuery.Attributes.Add("onkeydown", "SubmitKeyClick('butQuery');");
                            this.LBMove.Attributes.Add("onclick", "javascript:{if(confirm('确定移植所有选中信息吗？')==false) return false;}");
                            this.LBDel.Attributes.Add("onclick", @"javascript:{if(confirm('删除后将无法恢复数据！\n\n确定删除所有选中信息吗？')==false) return false;}");
                            this.LBDelAll.Attributes.Add("onclick", @"javascript:{if(confirm('此操作是清除所有档案柜中的所有成绩！\n\n清除后将无法恢复数据！\n\n确定清除所有成绩档案信息吗？')==false) return false;}");
                            this.ViewState["SortFiled"] = "GetCountFen";
                            this.ViewState["SortType"] = " Desc";
                            this.publicFun_0.GetFolderInfo(this.DDLArchiveFolder, "select ID,FolderName from GradeFolder where UPID=0 and  ( EditUserCode like '%," + this.httpCookie_0.Value + ",%' or BrowUserCode like '%,所有人员,%' or BrowUserCode like '%," + this.httpCookie_0.Value + ",%' or BrowDeptID like '%," + this.httpCookie_3.Value + ",%' or BrowDeptName like '%,所有部门,%' ) ", "2", this.httpCookie_0.Value, this.httpCookie_3.Value);
                            ListItem item = new ListItem("--选择档案柜--", "0");
                            this.DDLArchiveFolder.Items.Insert(0, item);
                            this.publicFun_0.GetFolderInfo(this.DDLMoveFolder, "select ID,FolderName from GradeFolder where UPID=0 and  EditUserCode like '%," + this.httpCookie_0.Value + ",%'", "1", this.httpCookie_0.Value, this.httpCookie_3.Value);
                            ListItem item2 = new ListItem("--选择档案柜--", "0");
                            this.DDLMoveFolder.Items.Insert(0, item2);
                            string str = this.publicFun_0.GetValues("select ParmValue from SysParmInfo where ParmMemo='SubStrLength'", "ParmValue").Trim();
                            if (str.Trim() == "")
                            {
                                str = "20";
                            }
                            this.ViewState["SubStrLen"] = str;
                            this.method_0();
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BCheckA", "alert('成绩查询权限未开放！')", true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.UPPart, this.Page.GetType(), "BCheck", "alert('此版本暂未授权,请拔打(0)13870606104手机号进行授权！')", true);
                    }
                }
            }
        }
    }
}

